package cn.itsource.pet.controller;

import cn.itsource.basic.util.AjaxResult;
import cn.itsource.org.domain.Department;
import cn.itsource.pet.pojo.domain.PetType;
import cn.itsource.pet.service.PetService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 宠物类型控制层
 */
@RestController
@RequestMapping("/petType")
public class PetTypeController {
    @Autowired
    private PetService service;
    @GetMapping("/findPetTypeList")
    public AjaxResult findAllpetType(){
        List<PetType> allPetType = service.findAllPetType();
        return AjaxResult.createSuccess(allPetType);
    }
    @PostMapping("/tree")
    @ApiOperation(value = "查询品种无限极树") //swagger API
    public AjaxResult deptTree(){
        //查询
        List<PetType> petTypes = service.deptTree();
        //返回
        return AjaxResult.createSuccess(petTypes);
    }


}
